package com.dsg.kf.front.context;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class Authterceptor extends HandlerInterceptorAdapter{

	//拦截器
	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		  //获取Session  
        HttpSession session = request.getSession();  
        Object obj = session.getAttribute(FrontContext.USER_SESSION);  
        if(obj != null){
            return true;  
        }  
        //不符合条件的，跳转到登录界面  
        request.getRequestDispatcher("/login/index.htm").forward(request, response);  
        return false;  
	}
}
